<template>
	<view class="fixedbar" @click="toTop" v-show="flag"><img src="https://www.mescroll.com/img/mescroll-totop.png" alt="" /></view>
</template>

<script>
export default {
	name: 'backTop',
	props: {
		flag: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {};
	},
	methods: {
		toTop() {
			uni.pageScrollTo({
				scrollTop: 0,
				duration: 300
			});
		}
	}
};
</script>

<style scoped>
.fixedbar {
	position: fixed;
	top: 90%;
	right: 30rpx;
	z-index: 999;
	width: 80rpx;
	height: 80rpx;
}
.fixedbar img {
	border-radius: 50%;
	width: 100%;
	height: 100%;
}
</style>
